package controllers;

import java.util.List;

import org.hibernate.SessionException;
import models.*;
import models.Relation;
import models.Tutorial;
import play.mvc.*;

public class Relations extends Controller {

	public static void index() {
		render();
	}

	/***
	 * This method is for deleting relations between tutorials
	 * 
	 * @author Nourhan Elmalahy
	 * @ @param relationID
	 */

	public static void deleteRelations(long tutorialId) {
		Tutorial t = Tutorial.findById(tutorialId);
		String title = t.Title;
		Relation r = Relation.find("tutorialTitle=?", title).first();
		r.delete();
		renderText("You have deleted the relation successfully!");
	}
	/***
	 * End --> Nourhan Elmalahy
	 */
}
